﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using IDAL.RF.PowerTest;
using Model.RF.PowerTest;

namespace BLL.RF.PowerTest
{
    public class PowerTest_temp
    {
        private static readonly IPowerTest_temp dal = DALFactory.DataAccess.CreatePowerTest_temp();


        //用于PIM测试数据的录入
        public bool PowerTest_tempAndItem_Insert(PowerTest_tempInfo ti, IList<PowerTestItemInfo> list)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = CommHelper.ListToDataTable<PowerTestItemInfo>(list);
                dt.Columns.Remove("ID");
                dt.Columns.Remove("Result");
                return dal.PowerTest_tempAndItem_Insert(ti, dt);
            }
            catch
            {
                return false;
            }
            finally
            {
                dt.Dispose();
            }
        }

        public bool PowerTest_temp_DisableRecordsbySN(string productSN)
        {
            try
            {
                dal.PowerTest_temp_DisableRecordsbySN(productSN);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public IList<PowerTest_tempInfo> PowerTest_temp_GetLatestbyProductSN(string sn)
        {
            return dal.PowerTest_temp_GetLatestbyProductSN(sn);
        }
    }
}
